import React from "react";
import { useRef } from "react";
import PubSub from "pubsub-js";

export default function Herosearch() {
  let con = useRef();

  let getname = () => {
    let value = con.current.value;
    PubSub.publish("keyword", value);
  };
  return (
    <>
      <div style={{ float: "right" }}>
        <input ref={con} type="search" placeholder="输入要搜索的名称" />
        <button onClick={getname}>搜索</button>
      </div>
    </>
  );
}
